package thirteen.test01;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test05 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入文件名：");
        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        File f = new File("./a/"+input);
        while (f.exists()){
            System.out.println("文件名已被占用，请重新命名：");
            Scanner scanner2 = new Scanner(System.in);
            String input2 = scanner2.next();
            f = new File("./a/"+input2);
        }
        f.createNewFile();
        System.out.println("文件创建成功");

    }
}